import pkg from './package'

export default {
  mode: 'spa',
  /*
   ** Headers of the page
   */
  head: {
    title: 'cms内容管理系统',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      { rel: 'stylesheet', href: '/styles/theme.scss' },
    ],
    // script: [
    //   {charset:'utf-8',src:'/cdn/element-ui/index.js'},
    //   {charset:'utf-8',src:'/cdn/avue/avue.min.js'},
    // ]
  },

  /*
   ** Customize the progress-bar color
   */
  loading: { color: '#fff' },

  /*
   ** Global CSS
   */
  css: [
    '@/assets/css/main.scss'
  ],

  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    { src: '@/plugins/iview', ssr: true },
    { src: '@/plugins/elementui', ssr: true },
    '@/plugins/sysconfig',
    '~plugins/echarts'
  ],

  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios'
    , '@nuxtjs/proxy'
  ],
  /*
   ** Axios module configuration
   */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
    proxy: true, // 表示开启代理
    prefix: '/api',  // 表示给请求url加个前缀 /api
    credentials: true // 表示跨域请求时是否需要使用凭证
  },
  proxy: {
    '/hboot': {
      target: 'http://ip365.highset.cn', // 目标接口域名
      changeOrigin: true, // 表示是否跨域
      // ws: true,
      pathRewrite: {
        '^/api': '/', // 把 /api 替换成 /
      }
    }
  },

  /*
   ** Build configuration
   */
  build: {
    /*
     ** You can extend webpack config here
     */
    loaders: {
      less: {
        javascriptEnabled: true
      },
      sass: {
        javascriptEnabled: true
      }
    },

    extend(config, ctx) {
      config.node = {
        fs: 'empty',
      }
    },
    vendor: ['axios'] //为防止重复打包
  },

  router: {
    middleware: ['meta', 'auth']
  }
}
